package com.lanmaoly.cunzheng.threadpoolfour;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author
 */
public class ThreadPoolExecutorTest {
    public static void main(String[] args) {
        ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(5);
        scheduledThreadPool.scheduleAtFixedRate(() -> {
            int i = 0;
            System.out.println("delay 1 seconds, and excute every 3 seconds" + ++i);
        }, 1, 3, TimeUnit.SECONDS);
    }
}